-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor template_ws
#44
Conversation
Originally, if a newly created workspace doesn't update the author info, it could lead to incorrect attribution.
…etter caching For example, common tools such as curl are seldomly changed, and could be executed before other dockerfile commands to save build time. As a side note, `useradd` is preferred over `adduser` for the following reasons: https://askubuntu.com/a/345986
…in ros base image As we will source the global ros2 env in `.bashrc`
…s` to `ros2-essentials` Related: #35
…ns and set domain ID to zero Co-authored-by: YuZhong-Chen <[email protected]> Co-authored-by: assume <[email protected]>
Fixes: #40 Co-authored-by: assume <[email protected]>
…bashrc`, Remove redundant `postCreateCommand.sh`
Hi, I think you missed installing Python pip in this section. ros2-essentials/template_ws/docker/Dockerfile Lines 40 to 43 in afdb58c
|
Co-authored-by: YuZhong-Chen <[email protected]>
Hi @YuZhong-Chen , I just pushed a fix, thanks! |
I think we can support multi-platform builds in this PR, otherwise, it will be difficult to refactor the existing workspace, such as To enable arm64 architecture support in ros2-essentials/husky_ws/docker/Dockerfile Lines 1 to 10 in 443c2bb
ros2-essentials/husky_ws/docker/Dockerfile Lines 51 to 56 in 443c2bb
ros2-essentials/husky_ws/docker/compose.yaml Lines 3 to 9 in 443c2bb
|
Co-authored-by: YuZhong-Chen <[email protected]>
@YuZhong-Chen Nice suggestion! just added this. |
I haven't used Docker build cache before, so I'm currently learning about it step-by-step from the official documentation. I believe our current Dockerfile is still missing some commands. Here’s an example from BuildKit: # syntax=docker/dockerfile:1
FROM ubuntu
RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt update && apt-get --no-install-recommends install -y gcc Based on the example above, we should:
I'm currently not sure if we need to mount If you want to learn more, I think this website explains it very clearly. |
I'm sorry, I didn't clarify the previous example well. You should mount the cache here in commit f8e86d9 By the way, we could add some examples in the TODO section to remind users to use the cache. # TODO: Add more commands here
# For example, to install additional packages, uncomment the following lines and add the package names
# RUN --mount=type=cache,target=/var/cache/apt \
# apt-get update && apt-get install -y \
# $OTHER_PACKAGES \
# && rm -rf /var/lib/apt/lists/* However, mounting the cache might involve changes, we can wait until the previous comment is resolved. |
… sharing to allow concurrent builds We only cache `/var/cache/apt` and do not cache `/var/lib/apt`, since the main purpose of this cache mount is to speed up package downloads. Caching `/var/lib/apt` might offer a slight speed improvement, but its potential drawbacks could outweigh the benefits. We use `sharing=private` instead of `sharing=locked`, since if we are building multiple images simultaneously, locking the cache may make the builds slower. In addition, the `private` sharing mode can still share caches across different image builds when the cache isn't accessed simultaneously. For more information, see the references in comments or the discussion in the PR: #44 (comment) Co-authored-by: YuZhong-Chen <[email protected]>
@YuZhong-Chen Thanks for the info! I'm also new to this feature and learned a lot by going through the detailed references you provided. I agree with your suggestions on this issue, and just pushed a fix accordingly. |
Remove the Gazebo cache since we use Docker volumes instead of cache in each workspace.
…ite errors. Sometimes we might use packages that are no longer maintained. Although these packages can compile normally, `rosdep` might report errors because the `package.xml` is not updated. Using this flag can help avoid this issue. If a package is missing, it will still be displayed in the terminal, so you don’t need to worry about missing error messages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added some commits to fix the issues I observed. If these commits are fine, I believe the current changes can be merged into the master branch.
By the way, should we rename the
master
branch tomain
? Although this change won’t affect anything, I prefer themain
naming convention, and the official default branch name has been updated. You can refer to this link for more information.
Thanks for reviewing this PR. I'll go ahead and merge it. I agree with you and just renamed the default branch from |
This refactor addresses several issues we encountered and discussed since the initial version of
template_ws
.This also simplifies some commands, improves performance, and automate commands to make the development process more streamlined.
I would appreciate any feedback from @YuZhong-Chen and @Assume-Zhan when you have time to ensure I didn’t miss anything. If it looks good, you could submit a review by simply approve this PR, and optionally leave some comments. Thank you!
After merging this PR, we still need to: